﻿using NetSync.Core;
using RabbitMQ.Client;

namespace NetSync.Rabbitmq
{
    public class RabbitMQConfig : NetConfig
    {
        public SslOption Ssl {  get; set; } = new SslOption();

        /// <summary>
        /// 为空，工作队列模式工作，数据直接发送到队列；否则以交换机模式工作，数据先发送到交换机，再匹配分发到队列
        /// </summary>
        public string ExchangeName {  get; set; }

        public string VirtualPath { get; set; } = "/";

        public uint MaxMessageSize { get; set; } = 64 * 1024 * 1024;

        /// <summary>
        /// 单组消费者数量
        /// </summary>
        public int ConsumerCountPerGroup { get; set; } = 1;

        public ushort PrefetchCount { get; set; } = 1;

        /// <summary>
        /// 生产者发送消息时是否每发送一次启动一个连接，完成时再断开；默认true;false只维护一长连接
        /// </summary>
        public bool NewConnectionPerSend { get; set; } = true;

        /// <summary>
        /// 数据接收时，应用程序处理消息异常时，消息是否回复Rabbitmq ack
        /// </summary>
        public bool ReceiveHandleErrorAck { get; set; } = true;
    }
}